package com.paomi.client.fragment.massage.presenter;


import com.hannesdorfmann.mosby3.mvp.MvpBasePresenter;
import com.paomi.client.bean.UserUtils;
import com.paomi.client.fragment.massage.MsgMvpView;
import com.paomi.client.fragment.massage.model.UnMyMsgBean;
import com.paomi.client.net.Api;
import com.paomi.client.net.BaseCallback;
import com.paomi.client.net.Constants;
import com.paomi.client.view.LoadingDialog;


import retrofit2.Call;

/**
 * Created by pc on 2018/10/25
 * Describe:
 * com.paomi.client.fragment.first.presenter
 */
public class MsgFraPre extends MvpBasePresenter<MsgMvpView> {
    public void loadMsgData() {
        if(UserUtils.getInstance().getUserInfo()!=null){
            LoadingDialog.get().showLoading();
            Api.getInstanceService(Constants.Ticket_URL).myUnMsgAll().enqueue(new BaseCallback<UnMyMsgBean>() {
                @Override
                public void onResponse(Call<UnMyMsgBean> call, UnMyMsgBean result) {
                    LoadingDialog.get().hideLoading();
                    if(isViewAttached()) {
                        getView().setMsgNum(result);
                    }
                }
            });
        }

    }
}
